package com.boot.unity.api.wx.controller;


import com.boot.unity.api.wx.service.WxBindMangerService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;




@RestController
@RequestMapping("/wx/bindManager")
@Validated
public class WxBindMangerController {
    private final Log logger = LogFactory.getLog(WxBindMangerController.class);

    @Autowired
    private WxBindMangerService wxBindMangerService;


    @GetMapping("/checkUser")
    public Object checkUser(String id) {
       return wxBindMangerService.checkUser(id);
    }


    /**
     * 更新用户的绑定信息为空
     * @param userid
     * @return
     */
    @GetMapping("/clearBind")
    public Object clearBind(String userid){
        return wxBindMangerService.clearBind(userid);
    }

    /**
     * 根据微信用户的ID获取数据
     *
     * @param id
     * @return
     */
    @GetMapping("schoolDetail")
    public Object schoolDetail(String id,String key) {
        return wxBindMangerService.schoolDetail(id,key);
    }

    @GetMapping("/getCode")
    public Object getCode(String mobile) throws Exception {
        return wxBindMangerService.getCode(mobile);
    }




    /**
     * 通过扫码绑定驾校管理人员
     */
    @GetMapping("scanBindManager")
    public Object scanBindManager(String id,String manangerid){
        return wxBindMangerService.scanBindManager(id,manangerid);
    }

    @GetMapping("/bind")
    public Object bind(String id, String name, String mobile, String cardNo, String persole, String code) {
        return wxBindMangerService.bind(id,name,mobile,cardNo,persole,code);
    }


    /**
     * 根据驾校管理人员的ID，获取数据
     *
     * @param id
     * @return
     */
    @GetMapping("mangerIdData")
    public Object mangerIdData(String id,String key) {
        return wxBindMangerService.mangerIdData(id,key);
    }

    /**
     * 判断驾校中心---角色认证 管理者信息是否正确
     * id[1：校长，2：财务，3：招生，4：教练]
     *
     * **/
    @GetMapping("/verification")
    public Object verification(String name, String mobile, String cardNo,String id) {
        return wxBindMangerService.verification(id,name,mobile,cardNo);
    }
}